package com.ssyt.yt1.day15;

/**
 * 自定义异常（了解），一般JDK提供的内置异常已经够用了！
 * 
 * @author Administrator
 *
 */
// public class MyIllegalArgumentsException extends RuntimeException {
public class MyIllegalArgumentsException extends Exception {

	public MyIllegalArgumentsException() {
		super();
	}

	public MyIllegalArgumentsException(String message) {
		super(message);
	}

	public static void main(String[] args) {
		try {
			test(-1);
		} catch (MyIllegalArgumentsException e) {
			e.printStackTrace();
		}
	}

	public static void test(int number) throws MyIllegalArgumentsException {
		if (number < 0) {
			throw new MyIllegalArgumentsException("输入的数字不能小于0");
		}
	}
}
